<#include "/WEB-INF/common/header.ftl"/>
<script type="text/javascript">
	var pathToImages = '${brandingStaticLocation?default("")}/default/classic/image/calendar/';
	var showCheckbox = false;
</script>
<@taskMacro.showBrandingStyle "dhtmlgoodies_calendar.css"/>
<@taskMacro.showBrandingJs "dhtmlgoodies_calendar.js"/>
<@taskMacro.showBrandingJs "Panels.js"/>
<script type="text/javascript">
	var strPositionText="";
	//select all
	function selAll() {
		var flag = true;
		if ($('checkControl').checked) {
			flag = true;
		} else {
			flag = false;
		}
		var strarray = document.getElementsByName("siteIds");
		for (var i = 0; i < strarray.length; i++) {
			if (!strarray[i].disabled) {
				strarray[i].checked = flag;
			}
		}
	}
	
	//del batch
	function delAllConfirm() {
		var delSites = document.myform.detailIds;
		if (delSites != null) {
			if (delSites.value) {
				delSites = [delSites];
			}
			var flag = 0;
			for (var i = 0; i < delSites.length; i++) {
				if (delSites[i].checked) {
					flag++;
				}
			}
			if (flag == 0) {
				eval('panel_tips').openPanel();
				return;
			}
			eval('panel_confirm').openPanel();
			<#--
			if (confirm('<@s.text name="superadmin.site.del.confirm"/>')) {
				//$('saveBackupParamMy').value = false;
				if ($('currentPage') != null) {
					$('currentPage').value = ${currentPage?if_exists};
				}
				$("myform").action = "delsitebatch.action?menuname=${menuname?if_exists}&sessionFlag=true&sessionFrom=${queryPathFromSession?if_exists}";
				$("myform").submit();
			}
			-->
		} else {
			eval('panel_tips').openPanel();
			return;
		}
	}
	
	
	function delGroup(id) {
		$("groupId").value = id;
		eval('panel_confirm').openPanel();
	}
	
	function search() {
		$("currentPage").value = 1;
		$("searchForm").submit()
	}
	function showSearchTime() {
		$("activeStartTime").value = "";
		$("activeEndTime").value = "";
		$("inActiveStartTime").value = "";
		$("inActiveEndTime").value = "";
		if ($F("siteStatus") == 2) {
			$("activeTime").style.display = "none";
			$("inActiveTime").style.display = "none";
		} else if ($F("siteStatus") == 1) {
			$("activeTime").style.display = "none";
			$("inActiveTime").style.display = "";
		} else if ($F("siteStatus") == 0) {
			$("activeTime").style.display = "";
			$("inActiveTime").style.display = "";
		}
	}
	
</script>  
  <div class="Main">
    <div class="Main_fix">
      <#include "/WEB-INF/common/side.ftl"/>
      <div class="Main_body" id="Main_body">
        <div class="Main_locationBar">
          <div class="Main_locationBar_head"></div>
                   <div class="Main_locationBar_body"><span id="CurrentPosition">任务管理系统 -> 用户组列表 </span>
          </div>
          
          <div class="Main_locationBar_foot"></div>
        </div>
        <div class="Main_bodySimpleSearchBar">
          <div class="Main_bodySimpleSearchBar_head"></div>
		  <div class="Main_bodySimpleSearchBar_body">
		  <input type="hidden" name="siteId4Js" id="siteId4Js"/>
		   <form id="searchForm" name="searchFrom" action="${base}/usergroup/grouplist.action?menuname=${menuname?if_exists}" method="post">
		   <#--
		    <input type="hidden" name="superadmin.saveBackupParam" value="true"/>
		    -->
		    <input type="hidden" name="currentPage" id="currentPage" value="${currentPage?if_exists}"/>
		    <input type="hidden" name="query_condition_save" value="true"/>
		    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="simpleSearchTable">
              <tbody>
                <tr>
                  <td class="title">组名：</td>
                  <td class="content">
                  		<input type="text" name="jobNumber" value="${groupName?if_exists?html}"  class="input"/>
                  </td>
                  <td class="content">&nbsp;</td>
				  <td class="content">&nbsp;</td>
                </tr>  
              </tbody>
            </table>
		   </form> 
        </div>
			
        	<div class="Main_bodySimpleSearchBar_foot"></div>
        </div>
      <div class="Main_buttonGroupBar">
        <div class="Main_buttonGroupBar_head"></div>
        
        <div class="Main_buttonGroupBar_body">
          <input type="button" class="button" value="查询" onClick="search();"/>
        </div>
        <div class="Main_buttonGroupBar_right"></div>
        <div class="Main_buttonGroupBar_foot"></div>
      </div>
      <div class="Main_bodyListBar">
        <div class="Main_bodyListBar_head"><span>列表</span> </div>
        <@opMacro.showActionResultMsg isSuccess=opResult/>
        <div class="Main_bodyListBar_body">
         <form id="myform" name="myform" method="post"/>
         <input type="hidden" name="groupId" id="groupId" />
          <table border="0" cellpadding="0" cellspacing="0" class="listTable">
            <tr>
              <th>组名</th>
              <th>组长</th>
              <th>组员</th>
              <th>操作</th>
            <#assign count=0 />   
            <#if userList?exists>
            	<#assign count=groupList.size() />   
	            <#list groupList as group>
	            <tr onmouseover="listTable_trMouseOver(this)" onmouseout="listTable_trMouseOut(this)">
	              <td>${(group.name)?if_exists}</td>
	              <td>${(group.leader.name)?if_exists}</td>
	              <td><@taskMacro.showMembers group.members/></td>
	              <td width="10%">
	              	<a href="${base}/usergroup/toview.action?groupId=${group.id}&menuname=${menuname?if_exists}">查看</a>
	              	<a href="${base}/usergroup/toedit.action?groupId=${group.id}&menuname=${menuname?if_exists}">编辑</a>
	              	<a href="javascript:onclick=delGroup(${group.id})">删除</a>
	              </td>
	            </tr>
	            </#list>
	        </#if>
	        <#if (pageSize - count - 1) &gt; 0>
	        <#list 0..(pageSize - count - 1) as i>
            <tr onmouseover="listTable_trMouseOver(this)" onmouseout="listTable_trMouseOut(this)">
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              </tr>
           </#list>
           </#if>
            <tr class="foot">
              <td colspan="4">
              		<@pageMacro.showPage page/>
              		<script language = 'JavaScript'>
				       function changePage(cpage){
					        //var url='list.action?menuname=${menuname?if_exists}&currentPage='+cpage;
					        $("currentPage").value = cpage;
					        $('searchForm').submit();
				        	return false;    
				       }
      			</script>     
               </td>
            </tr>
          </table>
          </form>
        </div>
        
        <div class="Main_bodyListBar_foot"></div>
      </div>
      <div class="Main_buttonGroupBar">
        <div class="Main_buttonGroupBar_head"></div>
        
        <div class="Main_buttonGroupBar_body">
          <input name="button" type="button" class="button" onclick="window.location='${base}/usergroup/toadd.action?menuname=1_6'" value="增加用户组"/> 
        <#--
          <input name="button" type="button" class="button" onclick="delAllConfirm();" value="批量删除"/>-->
		   
        </div>

        <div class="Main_buttonGroupBar_foot"></div>
      </div>
      </div>
	  </div>
  </div>
<#include "/WEB-INF/common/footer.ftl"/>
<script type="text/javascript">
	window.onload = function(){
		maskpanel = new MaskPanel("mask","MaskPanel",65);
		
		createConfirmPanel("panel_confirm","Panel_Confirm","信息","Panel ShortPanel",true,'0');
		panel_confirm.initConfirm2('删除','取消');
		panel_confirm.setConfirmText("确定删除吗?")
		
		createConfirmPanel("panel_tips","Panel_Tips","提示信息","Panel ShortPanel",false,'0');
		panel_tips.initConfirm2('关闭');
		panel_tips.setConfirmText("请选择需要删除的记录！")
		
		panel_confirm.okHandler = function(){
			if ($('currentPage') != null) {
				$('currentPage').value = ${currentPage?if_exists};
			}
			$("myform").action = "delete.action?menuname=${menuname?if_exists}";
			$("myform").submit();
		}
		
		createConfirmPanel("panel_confirm2","Panel_Confirm2","<@s.text name="superadmin.div.title.confirm"/>","Panel ShortPanel",false,'0');
		panel_confirm2.initConfirm2('<@s.text name="superadmin.button.ok"/>','Cancel');
		panel_confirm2.setConfirmText("<@s.text name="superadmin.site.del.confirm"/>")
		
		panel_confirm2.okHandler = function(){
			$("myform").action = "${base}/site/del.action?siteId=" + $F("siteId4Js") + "&menuname=${menuname?if_exists}";
			$("myform").submit();
		}
	}
	
	
	function createModalPanel(id,targetid,title,pclass,dragable,triggerObjid){	
		var str = id + " = new Panel('" + id + "','" + title + "','" + pclass + "'," + dragable + ");";
		str += id + ".eventObj = $('" + triggerObjid + "');";
		str += "CommonFunctions.cutNodeInto('" + targetid + "'," + id + ".content" + ");";
		str += id + ".setMaskPanel(maskpanel);" ;
		str += id + ".closePanel();";
		eval(str);
	}
	
	function createConfirmPanel(id,targetid,title,pclass,dragable,triggerObjid){
		var str = id + " = new ConfirmPanel('" + id + "','" + title + "','" + pclass + "'," + dragable + ");";
		str += id + ".eventObj = $('" + triggerObjid + "');";
		str += id + ".setMaskPanel(maskpanel);" ;
		str += id + ".closePanel();";
		//str += "CommonFunctions.StartFloat('interval_" + id + "'," + id + ".container,3);"; 
		eval(str);
	}
</script>

